/*
* Copyright 2010 ANDAGO INGENIERIA S.L.
*
* Licensed under the EUPL, Version 1.1 only (the "Licence");
* You may not use this work except in compliance with the
* Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in
* writing, software distributed under the Licence is
* distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the Licence for the specific language governing
* permissions and limitations under the Licence.
*/

package com.andago.utils;

import java.util.ArrayList;

import ieee_11073.part_10101.Nomenclature;

public class NomenclatureIEEE {
	
	
	
	public static final int MDC_PHID_PULSE_OXIM			= 400;
	
	public static final int MDC_PHID_THERMOMETER		= 800;
		
	public static final int MDC_PHID_WEIGH_SCALE		= 000;	
	
	
 	
	
	public static final String MDC_PHID_PULSE_OXIM_DESC		   = "Pulse Oximeter";
	
	public static final String MDC_PHID_THERMOMETER_DESC		= "Thermometer";
	
	public static final String MDC_PHID_WEIGH_SCALE_DESC		= "Weigh_Scale";	
	
	
    public static final String MDC_PULS_RATE_DESC				= "Heart rate";
	
	public static final String MDC_PULS_OXIM_SAT_O2_DESC		= "Oxygen saturation";
	
	public static final String MDC_MASS_BODY_ACTUAL_DESC		= "Weight";
	
	public static final String MDC_TEMP_BODY_DESC				= "Temperature"; 

	public static final String MDC_PRESS_BLD_NONINV_DESC		= "Blood pressure"; 

	
	public static String calculateUnit(int code){

		switch (code){
		case Nomenclature.MDC_DIM_PERCENT: return "%";
		case Nomenclature.MDC_DIM_BEAT_PER_MIN: return "bpm";
		case Nomenclature.MDC_DIM_DEGC: return "ºC";
		case Nomenclature.MDC_DIM_MIN: return "min";
		case Nomenclature.MDC_DIM_DAY: return "days";
		case Nomenclature.MDC_DIM_HR: return "h";
		case Nomenclature.MDC_DIM_KILO_G: return "kg";
		case Nomenclature.MDC_DIM_MMHG: return "mmHg";
		}
		return "";
	}
	
	public static String calculateAttribute(int code){
		switch (code){
		case Nomenclature.MDC_PULS_OXIM_PULS_RATE: return "HEART_RATE";
		case Nomenclature.MDC_PULS_OXIM_SAT_O2: return "OXYGEN";
		case Nomenclature.MDC_MASS_BODY_ACTUAL: return "WEIGHT";
		case Nomenclature.MDC_TEMP_BODY: return "TEMPERATURE";
		case Nomenclature.MDC_PRESS_BLD_NONINV: return "BLOOD_PRESSURE";
		case Nomenclature.MDC_PULS_RATE_NON_INV: return "HEART_RATE";
		}
	return "";
	}
	
	
	public static String getPhIDDesc(int code){

		switch (code){
			case MDC_PHID_PULSE_OXIM: return getMdcPhidPulseOximDesc();
			case MDC_PHID_THERMOMETER: return getMdcPhidThermometerDesc();
			case MDC_PHID_WEIGH_SCALE: return getMdcPhidWeighScaleDesc();	
		}
		return "";
	}
	

	public static String getAttributeDesc(int code){

		switch (code){
			case Nomenclature.MDC_PULS_OXIM_PULS_RATE: return getMdcPulsOximPulsRateDesc();
			case Nomenclature.MDC_PULS_OXIM_SAT_O2: return getMdcPulsOximSatO2Desc();
			case Nomenclature.MDC_MASS_BODY_ACTUAL: return getMdcMassBodyActualDesc();	
			case Nomenclature.MDC_TEMP_BODY: return getMdcTempBodyDesc();
			case Nomenclature.MDC_PULS_RATE_NON_INV: return getMdcBloddPressurePulsRateDesc();
		}
		return "";
	}
	
	
	public static int getAttributeCode (String attribute, int phID){
		
		
		if (attribute.equals(MDC_PULS_RATE_DESC)) {
			if ((phID >= 400) && (phID<=499))return Nomenclature.MDC_PULS_OXIM_PULS_RATE;			
			else if ((phID >= 700) && (phID <=799)) return Nomenclature.MDC_PULS_RATE_NON_INV;
			else return -1;
		}
		else if (attribute.equals(MDC_PULS_OXIM_SAT_O2_DESC)) return Nomenclature.MDC_PULS_OXIM_SAT_O2;
		else if (attribute.equals(MDC_MASS_BODY_ACTUAL_DESC)) return Nomenclature.MDC_MASS_BODY_ACTUAL;
		else if (attribute.equals(MDC_TEMP_BODY_DESC)) return Nomenclature.MDC_TEMP_BODY;
		else if (attribute.equals(MDC_PRESS_BLD_NONINV_DESC)) return Nomenclature.MDC_PRESS_BLD_NONINV;
		else return -1;
		
	}
	
	public static ArrayList<Integer> getAttributesDevice10404(){
		
		ArrayList<Integer> measuremtsDevice= new ArrayList<Integer>();
		
		measuremtsDevice.add(Nomenclature.MDC_PULS_OXIM_PULS_RATE);
		measuremtsDevice.add(Nomenclature.MDC_PULS_OXIM_SAT_O2);
		
		return measuremtsDevice;
		
		
	}
	
	
	public static ArrayList<Integer> getAttributesDevice10407(){
		
		ArrayList<Integer> measuremtsDevice= new ArrayList<Integer>();
		
		measuremtsDevice.add(Nomenclature.MDC_PRESS_BLD_NONINV);
		measuremtsDevice.add(Nomenclature.MDC_PULS_RATE_NON_INV);
		
		return measuremtsDevice;
		
		
	}

	public static ArrayList<Integer> getAttributesDevice10415(){
		
		ArrayList<Integer> measuremtsDevice= new ArrayList<Integer>();
		
		measuremtsDevice.add(Nomenclature.MDC_MASS_BODY_ACTUAL);
		
		return measuremtsDevice;
		
		
	}
	
	public static ArrayList<Integer> getAttributesDevice10408(){
		
		ArrayList<Integer> measuremtsDevice= new ArrayList<Integer>();
		
		measuremtsDevice.add(Nomenclature.MDC_TEMP_BODY);
		
		return measuremtsDevice;
		
	}
	

	public static int getMdcPhidPulseOxim() {
		return MDC_PHID_PULSE_OXIM;
	}

	public static int getMdcPhidThermometer() {
		return MDC_PHID_THERMOMETER;
	}

	public static int getMdcPhidWeighScale() {
		return MDC_PHID_WEIGH_SCALE;
	}

	public static String getMdcPhidPulseOximDesc() {
		return MDC_PHID_PULSE_OXIM_DESC;
	}

	public static String getMdcPhidThermometerDesc() {
		return MDC_PHID_THERMOMETER_DESC;
	}

	public static String getMdcPhidWeighScaleDesc() {
		return MDC_PHID_WEIGH_SCALE_DESC;
	}

	public static String getMdcPulsOximPulsRateDesc() {
		return MDC_PULS_RATE_DESC;
	}
	
	public static String getMdcBloddPressurePulsRateDesc() {
		return MDC_PULS_RATE_DESC;
	}

	public static String getMdcPulsOximSatO2Desc() {
		return MDC_PULS_OXIM_SAT_O2_DESC;
	}

	public static String getMdcMassBodyActualDesc() {
		return MDC_MASS_BODY_ACTUAL_DESC;
	}

	public static String getMdcTempBodyDesc() {
		return MDC_TEMP_BODY_DESC;
	}
}
